package com.dhj.jvmstudy.chapter08;

/**
 * 强引用测试
 * 强引用的对象都是可触及的，垃圾收集器就永远不会回收掉被引用的对象。
 */
public class StrongReferenceTest {

    public static void main(String[] args) throws InterruptedException {
        StringBuffer str = new StringBuffer("hello world.");
        StringBuffer str1 = str;

        str = null;
        System.gc();

        Thread.sleep(3000);

        System.out.println(str1);
    }

}
